package top.honlnk.czuan.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.honlnk.czuan.common.result.Result;
import top.honlnk.czuan.pojo.vo.GetTranslationVO;
import top.honlnk.czuan.service.GetService;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/get")
public class GetController {

    @Autowired
    private GetService getService;

    @GetMapping("/translationOfText")
    public Result<List<GetTranslationVO>> getTranslationInfo(String text) {

        if (text == null || text.isEmpty()) {
            return Result.success(List.of());
        }

       List<GetTranslationVO> translationInfoList = getService.getTranslationInfo(text);

        return Result.success(translationInfoList);
    }
}
